/*
 * @Author: your name
 * @Date: 2020-08-25 00:08:48
 * @LastEditTime: 2021-08-14 09:17:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \Motor024\Src\motorb.c
 */
0942
cccc
eeee
0910
0916-2
#include "location.h"
#include "rtthread.h"
#include "stm32f0xx.h"
#include "main.h"
#include "motorb.h"
#include "uart.h"
MOTOR_STRUCT motor;
//struct  rt_semaphore  mb_sem ;//motor big sem

20220118
/**
 * @description: motor back to location sense
 * @param {type} 
 * @return {type} 0: OK, 1:time out
 */
rt_uint8_t move2right(void)
{
    rt_uint16_t timeout = 0;
    rt_uint16_t delaytime = 50;
//    static rt_uint8_t move_flag = 0;
//    move_flag = 0;
    motor2_back();
    while (1)
    {
        if(READ_L3_BACK==0)
        {
            motor2_close();
//            KEY_FLAG = KEY_STOP;
            rt_thread_mdelay(5);
            return 0;
        }
// //        if(move_flag == 0)
//         {
// //            move_flag = 1;
           
//         }
// //        timeout++;
// //        if(timeout == 5000/delaytime)
// //        {
// //            motor2_close();
// //            return 1;
// //        }

        rt_thread_mdelay(1);
    }
    
}